<?php

include_once ('../../__global.php');
class atme extends ml_controller 
{
    private $page = 1;
    private $pagesize = 10;
    
    private $_feedlist;
    private $_contentlist;
    private $_nicks;
    
    public function init()
    {
        $this->set_access(self::ACCESS_SELF , self::NOACCESS_REDIRECT );
    }
    public function initParam()
    {
        $this->page = abs((int)$this->input('page' , 'g' , 1));
    }

    public function checkParam()
    {
        
        if($this->page < 1)
            $this->page = 1;
    }
    public function main()
    {
        $uid = $this->__visitor['uid'];
        
        ml_tool_actionlog::add_other_action($this->__visitor['uid'] , ML_SINAACTCODE_VIEW_HOME_ATME);
        
        $oRds = new ml_model_rdsNotice();
        $aRs = $oRds->getNotice($uid);
        if($this->page == 1)
        {
            $oRds->clean_one_field($uid , ml_model_rdsNotice::NTCTYPE_ADDATME  );
        }
        $cnt['comment']=intval($aRs[ml_model_rdsNotice::NTCTYPE_ADDCOMMENT  ]);
        $cnt['atme']=intval($aRs[ml_model_rdsNotice::NTCTYPE_ADDATME  ]);
        $cnt['atti']=intval($aRs[ml_model_rdsNotice::NTCTYPE_ADDATTITUDE  ]);
        
        $data = array();
        //获取用户名片信息        
        $obizUser = ml_biz_user_getinfo::get_instance();
        $obizUser->initUser($uid,$uid);
        $arr = $obizUser->getUserArea();
        $data = array_merge($data,$arr);
        
        $oAtme = new ml_biz_feed_atMe();
        $block_num = ($this->page-1)*3;
        $rs = $oAtme->main($uid , $block_num);
        if(!$rs)
            $this->redirect(ML_PAGE_SYSTEM_BUSY);
            
        $data['atme_html'] = implode('' , $oAtme->get_html());
        $total_block = ceil($oAtme->get_total()/ml_biz_atmeOutput::PAGESIZE );
        
        $data['cnt'] =$cnt;
        $this->set_scope_var('$totalPage' , ceil($total_block / 3));
        $this->set_scope_var('$currentPage' , $this->page);
        $this->set_scope_var('$segment' , 0);
        $this->set_scope_var('$lastSegment' , $this->block == $total_block ? true : false);
        $this->page_output('user::atme' , $data);
    }
}
new atme();